//
//  BCSureEnabledButton.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/12/10.
//  Copyright © 2018 guoshikeji. All rights reserved.
//

#import "BCSureEnabledButton.h"

@implementation BCSureEnabledButton

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.adjustsButtonWhenDisabled = false;
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
        self.layer.cornerRadius = 2;
        //
        self.enabled = false;
    }
    return self;
}


- (void)setEnabled:(BOOL)enabled {
    [super setEnabled:enabled];
    //
    if (enabled) {
        UIColor *color = self.enabledBackgroundColor;
        if (!color) {
            color = [UIColor darkMainColor];
        }
        self.backgroundColor = color;
    }else {
        UIColor *color = self.unEnabledBackgroundColor;
        if (!color) {
            color = [UIColor qmui_colorWithHexString:@"#9A9A9A"];
        }
        self.backgroundColor = color;
    }
}

@end
